﻿<!--
Project: ClipFlair (http://ClipFlair.codeplex.com)
Filename: Browser.xaml
Version: 20150204
-->

<UserControl x:Class="ClipFlair.Browser.Browser"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:img="clr-namespace:ImageButtons;assembly=ImageButtons"
  xmlns:local="clr-namespace:ClipFlair.Browser"
  mc:Ignorable="d"
  d:DesignHeight="300" d:DesignWidth="400"
  IsTabStop="True"
  >

  <DockPanel
    x:Name="LayoutRoot"
    LastChildFill="True"
    >

    <!-- TOOLBAR -->

    <DockPanel
      DockPanel.Dock="Top"
      LastChildFill="True"
      >
      <Button
        x:Name="btnBack"
        Content="&lt;"
        DockPanel.Dock="Left"
        Click="btnBack_Click"
        Visibility="Collapsed"
        />
      <Button
        x:Name="btnForward"
        Content="&gt;"
        DockPanel.Dock="Left"
        Click="btnForward_Click"
        Visibility="Collapsed" />
      <Label
        Content="Address: "
        Target="{Binding ElementName=edAddress}"
        DockPanel.Dock="Left"
        />
      <img:ImageButton
        x:Name="btnGo"
        ToolTipService.ToolTip="Go"
        Image="Images/Go.png"
        ImageHover="Images/Go_hover.png"
        DockPanel.Dock="Right"
        Click="btnGo_Click"
        />
      <TextBox
        x:Name="edAddress"
        Text="{Binding Path=Source, RelativeSource={RelativeSource AncestorType=local:Browser}, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}"
        />
    </DockPanel>

    <!-- BROWSER -->

    <Grid DockPanel.Dock="Top">

      <Button x:Name="btn"/> <!-- obscured by the following controls, only used for OnGotFocus of the UserControl to fire -->

      <WebBrowser
        x:Name="web"
        Source="{Binding Path=Source, RelativeSource={RelativeSource AncestorType=local:Browser}, Mode=TwoWay}"
        ScrollViewer.HorizontalScrollBarVisibility="Auto"
        ScrollViewer.VerticalScrollBarVisibility="Auto"
        LoadCompleted="web_LoadCompleted"
        />

      <Rectangle x:Name="webOverlay" IsHitTestVisible="False"> <!-- letting pointer events get grabbed by WebBrowser or Button above -->
        <Rectangle.Fill>
          <WebBrowserBrush x:Name="webBrush" SourceName="web" />
        </Rectangle.Fill>
      </Rectangle>

    </Grid>

  </DockPanel>
</UserControl>
